<?php
	require_once($_SERVER['DOCUMENT_ROOT'].'/ukkepuk/source/php/classes/beans/Kid.php'); 
	require_once($_SERVER['DOCUMENT_ROOT'].'/ukkepuk/source/php/classes/beans/Diaper.php'); 
	require_once($_SERVER['DOCUMENT_ROOT'].'/ukkepuk/source/php/classes/dao/UkkepukDao.php'); 

	$kid = new Kid();
	$diaper = new Diaper();
	$ukkepukDao = new UkkepukDao();
	
	$kid->id = $_POST['kidId'];
	$diaper->type = $_POST['dType'];
	$diaper->setTime($_POST['dTimestamp']);
	

	header("Content-Type:text/xml");  
	echo "<?xml version=\"1.0\" encoding=\"UTF-8\" ?>";
	
	if($ukkepukDao->saveDiaperForKid($diaper, $kid)){
		echo "<msg status=\"ok\" saveType=\"diaper\">";
		echo "<diaper timestamp=\"".$diaper->getTime()."\" type=\"".$diaper->type."\"/>";
		echo "</msg>";
	}
	else
		echo "<msg status=\"error\" saveType=\"diaper\" />";
			

?>